package com.kakaxi.mybilibili.view;

import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;

import com.kakaxi.mybilibili.R;
import com.kakaxi.mybilibili.utils.DensityUtil;

/**
 * 统一刷新按钮的刷新颜色和刷新按钮的刷新位置微调
 * Created by kakaxi on 16/11/9.
 */

public class MySwipeRefreshLayout extends SwipeRefreshLayout {

    /** 默认刷新按钮刷新时停止的位置 **/
    public static int DEFAULT_CIRCLE_TARGET = 26;

    /** 避免刷新按钮卡在界面上的偏移值 **/
    public static int DEFAULT_START_OFFSET = 10;

    public MySwipeRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));
        this.setProgressViewOffset(false, -(this.getProgressCircleDiameter() +
                DEFAULT_START_OFFSET), DensityUtil.dipToPx(context, DEFAULT_CIRCLE_TARGET));
    }

}
